﻿using RemoteManger.Entity;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RemoteManger
{
    public partial class GroupEdit : Form
    {
        SqlSugarScopeProvider db;
        public GroupEdit()
        {
            InitializeComponent();
            db = SqlHelper.GetInstance();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
  
        private void button1_Click(object sender, EventArgs e)
        {
            MachineGroupInfo group = new MachineGroupInfo();
            group.GroupName = this.txtName.Text;
            group.Remark = this.txtRemark.Text;
            group.Id =SnowFlake.GenerateId();
            bool result = db.Insertable(group).ExecuteCommand() > 0;
            if (result)
            {
                MessageBox.Show("添加成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("添加失败");
            }
            this.Close();
        }
    }
}
